package testng.mockito;

import java.util.List;
import java.util.stream.Collectors;

class MovieLister {
    MovieFinder finder;

    MovieLister(MovieFinder finder) {
        this.finder = finder;
    }

    List<String> movieNamesDirectedBy(String director) {
        return finder.findAll().stream()
                .filter(movie -> movie.isDirectedBy(director))
                .map(Movie::getName)
                .collect(Collectors.toList());
    }
}
